//
//  NSObject+CYHTTP.h
//  MyTools
//
//  Created by baidu on 6/8/16.
//  Copyright © 2016 caoyuan. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSObject (CYHTTP)
/**
 *  基于AFNetworking的封装，json解析get请求
 *
 *  @param url       NSString url
 *  @param paramDict NSDictionary
 *  @param block     返回结果的回调
 */
- (void)get:(NSString *)url
  withParam:(NSDictionary *)paramDict
resultBlock:(void (^)(NSDictionary *responseDict, NSError *error))block;


/**
 *  基于AFNetworking的封装，json解析post请求
 *
 *  @param url       NSString url
 *  @param paramDict NSDictionary
 *  @param block     返回结果的回调
 */
- (void)post:(NSString *)url
   withParam:(NSDictionary *)paramDict
 resultBlock:(void (^)(NSDictionary *responseDict, NSError *error))block;

/**
 *  系统自带的NSURLConnection的封装，同步的请求
 *
 *  @param url      NSString url
 *  @param postData dic
 *
 *  @return dic
 */
- (NSMutableDictionary*)post:(NSString*)url postDic:(NSMutableDictionary*)postData;
/**
 *  系统自带的NSURLConnection的封装，同步的请求
 *
 *  @param url NSString url
 *
 *  @return dic
 */
- (NSMutableDictionary*)get:(NSString*)url;
/**
 *  系统自带的NSURLConnection的封装，同步的请求
 *
 *  @param url      NSString url
 *  @param postData dict
 *
 *  @return dic
 */
- (NSMutableDictionary*)put:(NSString*)url postDic:(NSMutableDictionary*)postData;
@end
